package com._常用API;

import java.lang.reflect.Field;
import java.nio.file.Files;

/**
 * string stringbuffer stringbuild
 *
 * @author liyiruo
 * @Description
 * @Date 2023/1/13 下午4:23
 */
public class StringT {

    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        StringBuffer buffer = new StringBuffer();
        buffer.append("i");
        buffer.append('a');
        buffer.append("1234567890");
        buffer.insert(10, "abcd");
        buffer.appendCodePoint(65);
        System.out.println(buffer.toString());

        StringBuilder builder = new StringBuilder();
        builder.append("i");
        builder.append('G');
        builder.append("1234567890");
        builder.insert(8, "ppppppp");
        System.out.println(builder.toString());

        String s = new String("abcd");
        Field value=s.getClass().getDeclaredField("value");
        value.setAccessible(true);
        value.set(s,"aaaaaaaaaaa".toCharArray());
        System.out.println(s);

    }
}
